<template>
	<view class="body">
		<view class="title-box" @click="back()">
			<!-- <view class="title">荷式拍卖列表</view> -->
			<text class="iconfont icon-left"></text>
		</view>
		<view class="item" v-for="(item,index) in list">
			<view class="card">
				<view class="image">
					<image :src="globals+item.icon" style="width: 100%;height: 100%;border-radius: 100%;" mode=""></image>
				</view>
				<view class="info">
					<view class="name">{{item.username}}</view>
					<view class="email">{{item.email}}</view>
				</view>
				<view class="follow" @click="remove(item)">
					<image src="../../static/fllow.png" style="width: 100%;height: 100%;" mode=""></image>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import apis from '@/api/index.js'
		import G from '@/config/global.js'
	import {
		requestApi,
		uphttp
	} from '@/utils/request.js'
	// 导入公共组件方法
	import common from '@/common/js/common.js';
	export default {
		data() {
			return {
				list: [{
					id: "1",
					username: "张三",
					email: "1@qq.com",
					icon: "http://localhost:8080/api/1111.png"
				}, {
					id: "1",
					username: "张三",
					email: "1@qq.com",
					icon: "http://localhost:8080/api/1111.png"
				}],
				globals:"",
				user:{}
			}
		},
		onLoad() {
			this.globals = G.REQUEST_URL;
			this.user = uni.getStorageSync("user");

			this.getList();
		},
		methods: {
			getList() {
				requestApi(apis.follow.list, this.user, "POST").then(res => {
				this.list = res.data;
				})
			},
			remove(item) {
				console.log(item)
				requestApi(apis.follow.del,item,'POST').then(res=>{
					if(res.code == 200){
						uni.showToast({
							icon:"none",
							title:"取消关注成功"
						})
						this.getList();
					}
				})
			},
			back(){
				uni.navigateBack({delta:1})
			}
		}
	}
</script>

<style>
	.body {
		padding: 0 32rpx;
		min-height: 100vh;
		background-image: url('../../static/bgc.png');
		background-size: 100% 100%;
		background-repeat: no-repeat;
	}

	.item {
		padding-top: 20rpx;
	}

	.card {
		background-color: rgba(255, 255, 255, 0.7);
		display: flex;
		justify-content: space-between;
		align-items: center;
		box-sizing: border-box;
		box-shadow: rgba(0, 0, 0, 0.08) 0px 0px 3px 1px;
		border-radius: 32rpx;
		padding: 32rpx;
	}

	.image {
		width: 64rpx;
		height: 64rpx;
		margin-left: 40rpx;
	}

	.follow {
		width: 32rpx;
		height: 32rpx;
	}

	.name {
		color: #000;
		font-size: 28rpx;
	}

	.email {
		color: #333;
		font-size: 24rpx;
	}
</style>